package com.example.controller;



import com.alibaba.dubbo.config.annotation.Reference;
import com.example.pojo.Goods;
import com.example.service.GoodsAdminService;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/GoodsController")
public class GoodsController {
    @Reference
    GoodsAdminService GoodsAdminService;

@RequestMapping("/GetAll")
    public String getAll(HttpSession session) {
        List<Goods> all = GoodsAdminService.getAll();

        session.setAttribute("goodsAllGoods",all);
    List<Goods> goodsAllGoods = ( List<Goods>)session.getAttribute("goodsAllGoods");

    return "redirect:/ListAllGoods.jsp";
    }
    @RequestMapping("/findByIdGoods")
public String findByIdGoods(HttpSession session,Integer id){

        Goods infoGoods = GoodsAdminService.findById(id);

        session.setAttribute("infoGoods",infoGoods);

        return "redirect:/InfoGoods.jsp";

}
}